package com.ysalliance.getFan.organization.myview;

import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.ysalliance.getFan.organization.R;

import androidx.annotation.Nullable;


public class ItemClassView extends LinearLayout {
    private TextView tv_class_item_name;//item的文字
    private TextView tv_right;//item的文字



    public ItemClassView(Context context) {
        this(context,null);
    }

    public ItemClassView(Context context, @Nullable AttributeSet attrs) {
        this(context, attrs,-1);
    }

    public ItemClassView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
       LayoutInflater.from(getContext()).inflate(R.layout.item_class_view,this);
       /* LayoutInflater mInflater = LayoutInflater.from(context);
        View myView = mInflater.inflate(R.layout.item_view, null);
        addView(myView);*/
        TypedArray ta=context.obtainStyledAttributes(attrs,R.styleable.item_class_view);
        tv_class_item_name = (TextView) findViewById(R.id.tv_class_item_name);
        tv_right = (TextView) findViewById(R.id.tv_right);
        tv_right.setVisibility(INVISIBLE);

        tv_class_item_name.setText(ta.getString(R.styleable.item_class_view_my_class_name));

        ta.recycle();
    }


    public void setRightText(String text){
        tv_right.setText(text);
        tv_right.setVisibility(VISIBLE);
    }

}
